package com.sfac.springboot.modules.test.dao;

import com.sfac.springboot.modules.test.entity.Student;
import org.hibernate.query.NativeQuery;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * StudentDao
 */
@Repository
public interface StudentDao extends JpaRepository<Student,Integer> {

    List<Student> findByStudentName(String studentName);

    @Query(nativeQuery = true,value="select * from  test_student where id = :id")
    //@Query(value="from Student where id = :id")
    Student getStudentById(@Param("id") int id);

}
